home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 4⁄20⁄90 / 1120-Scalable Views revis-Apr90 < prev    next >
Encoding:
Text File  |  1990-04-16  |  5.1 KB  |  116 lines  |  [TEXT/GEOL]

  1. Item    9515161                         16-April-90        17:54DST
  2.  
  3. From:   UK0392                          EHN & DIJ Oakley,IDV
  4.  
  5. To:     POWERUP.ENG                     Power Up Software,PRT
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    Scalable Views revisited
  10.  
  11. James,
  12. I have now had a chance to study your exemplary Scalable Views class, as
  13. promised.  Whilst it is an impressive piece of work - far more clever than I
  14. would ever achieve - I think that it has some fundamental flaws in its
  15. approach, some of which we have already discussed.
  16.  
  17. I think that the ability for the programmer to control exactly what is scaled,
  18. and how, is crucial in all applications which would use scalable views.  Aside
  19. from specialist CAD/CAM areas, suppose that I have an image in a view, which
  20. has a content which is a representation of what I am producing, and various
  21. labels etc.  If I scale it with Scalable Views, then I presume that everything
  22. will be changed, so that my labels etc. would become either huge or tiny.
  23. Similarly, spatial relationships may not have to be scaled so simply - a one
  24. pixel gap may have to be maintained however small the view becomes, in order to
  25. retain clarity & meaning.
  26.  
  27. The programmer also requires control over whether the document when printed is
  28. scaled or not - I cited the instance of our users, who want (in fact HAVE) to
  29. be able to print at the current scaling, in contrast with the example of
  30. a DTP program, where no matter what the current visible scale, the printed
  31. output must be at full scale (although thumbnails might be a useful extension
  32. of my proposals?).
  33.  
  34. I note that your scaling factor must be an integer.  I regret that integral
  35. values are often insufficient for drawing programs, in that the almost
  36. infinitely variable powers afforded by reals are needed - this becomes more
  37. critical, of course, once we are talking of magnification of the view, rather
  38. than reduction.
  39.  
  40. I am also concerned that Scalable Views is very unlikely ever to be a part of
  41. MacApp, as it imposes not inconsiderable code & data overhead (polygon and
  42. region stuff, for example) and yet another set of coordinate conversions.
  43. Logically, then, scalable views would be another class of view, which I think
  44. makes life less elegant and more complex.  Contrast instead the lean and simple
  45. (for I am of simple mind) approach which I would beg to submit for your
  46. consideration:
  47.  
  48. CONST {add}
  49.    cZoomIn4=   304; {magnify by factor of 4}
  50.    cZoomIn2=   305; {magnify by factor of 2}
  51.    cZoomOut2   =   306; {reduce by factor of 2}
  52.    cZoomOut4   =   307; {reduce by factor of 4}
  53.    cZoomFit=   308; {scale to fit in window}
  54.    cNormSize   =   309; {default size}
  55.    {could also have set to particular scale, of course, or fixed
  56.    percentages e.g. DTP applications}
  57.  
  58. TYPE
  59. {to} TDocument = OBJECT (TEvtHandler)
  60. {add field}
  61.    fZoomPower: REAL; {current zoom power}
  62.    {1.0 -> 1:1 ratio on screen, with 1 pixel = 1 unit,
  63.    whilst (e.g.) 100.0 -> 1:100 ratio, with 1 pixel
  64.    = 100 units.  It is implementation dependent as
  65.    to what limits you place on this; numbers between
  66.    0 and 1 are magnifications, e.g. 0.5 is 2:1 ratio}
  67.    END;
  68.  
  69. {to} TView = OBJECT (TEvtHandler)
  70. {alter to}
  71.    PROCEDURE TView.Draw(area: Rect; aZoomPower: REAL);
  72.    END;
  73.  
  74. {then for each drawable object, you require a method:}
  75.    PROCEDURE TMyObject.Draw(theZoom: REAL);
  76.    {it is the responsibility of the programmer to implement scaling of
  77.    the drawing, if required}
  78.  
  79. {and one new command}
  80.    TZoomCommand= OBJECT (TCommand)
  81.    fOldZoom:   REAL;
  82.    fNewZoom:   REAL;
  83.     {Initialization}
  84.    PROCEDURE TZoomCommand.IZoomCommand(aCmdNumber: CmdNumber;
  85.    myDocument: TDocument; itsView: TView; itsScroller: TScroller;
  86.    oldZoom: REAL); {initialise & calculate fNewZoom from aCmdNumber}
  87.     {Command performing}
  88.    PROCEDURE TZoomCommand.DoIt; OVERRIDE; {call view to redraw to fNewZoom}
  89.    PROCEDURE TZoomCommand.UndoIt; OVERRIDE; {call view to redraw to fOldZoom}
  90.    PROCEDURE TZoomCommand.RedoIt; OVERRIDE; {call view to redraw to fNewZoom}
  91.     {Utility routine}
  92.    PROCEDURE TZoomCommand.DoZoom(oldZoom, newZoom: REAL); {actually call it}
  93.     {Mouse Tracking}
  94.     {if you wish to, you can implement marqueed zoom areas, or the 'click
  95.     and zoom' magnifying glass of many drawing apps, with methods here.  The
  96.     only complication, of course, is retaining your place in the view!}
  97.     {Debugging}
  98.    PROCEDURE TZoomCommand.Fields (PROCEDURE DoToField (fieldName: Str255;
  99.      fieldAddr: Ptr;
  100.      fieldType: INTEGER)); OVERRIDE;
  101.    END;
  102.  
  103. all of which are almost trivial to implement.  If an application does **not**
  104. require scaling/zooming, then the overhead is nil.  If it does, then it is
  105. all plane sailing to implement, and there is hardly any unwanted overhead.  As
  106. regards my applications, whilst your Scalable Views would be of no use to them,
  107. the above (which is not, incidentally, how I have implemented it yet!) would
  108. definitely be a great improvement to MacApp.
  109.  
  110. If there is interest, I would be happy to flesh out the above in the Class
  111. Room, so folk can compare and contrast the two approaches to scaling views, and
  112. we can also take on board the requirements of others.
  113.  
  114. Regards, Howard.
  115.  
  116.